package com.hsjk.szwj.module.train.controller.app;

import com.hsjk.szwj.framework.common.pojo.CommonResult;
import com.hsjk.szwj.framework.security.core.annotations.PreAuthenticated;
import com.hsjk.szwj.module.train.controller.app.vo.knowledge.KnowledgeListBySetIdRespVO;
import com.hsjk.szwj.module.train.service.IKnowledgeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.hsjk.szwj.framework.common.pojo.CommonResult.success;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/08/04 00:52
 **/
@Tag(name = "应用端 - 培训知识点相关接口")
@RestController
@RequestMapping("/train/knowledge")
@Validated
public class AppKnowledgeController {

    @Resource
    private IKnowledgeService knowledgeService;

    @GetMapping("/list-by-set-id")
    @Operation(summary = "根据知识点集ID查询知识点列表")
    @PreAuthenticated
    public CommonResult<List<KnowledgeListBySetIdRespVO>> listKnowledgeBySetId(@RequestParam Long knowledgeSetId) {
        return success(knowledgeService.listKnowledgeBySetId(knowledgeSetId));
    }

}
